﻿@Html.DevExpress().GridView(
             ss =>
             {
                 ss.Name = "gvEditing";
                 ss.KeyFieldName = "FYGZAllowanceNo";
                 ss.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                 ss.CallbackRouteValues = new { Controller = "YGZAllowance", Action = "YGZAllowancePartial" };
                 ss.SettingsPager.PageSize = EnterpriseFund.Common.GlobalConstant.CONSTRING_PAGESIZE;

                 ss.Columns.Add(column =>
                 {
                     column.Caption = "操作";

                     column.SetDataItemTemplateContent(c =>
                     {

                         Html.DevExpress().HyperLink(s => { s.Name = "linkEdit" + c.VisibleIndex; s.Properties.Text = "修改"; s.ToolTip = "修改"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_Edit.png"); s.Properties.ClientSideEvents.Click = "function(){Edit('" + DataBinder.Eval(c.DataItem, "FYGZAllowanceNo") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                         ViewContext.Writer.Write("  ");
                         Html.DevExpress().HyperLink(s => { s.Name = "linkDel" + c.VisibleIndex; s.Properties.Text = "删除"; s.ToolTip = "删除"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_delete.png"); s.Properties.ClientSideEvents.Click = "function(){Del('" + DataBinder.Eval(c.DataItem, "FYGZAllowanceNo") + "','" + c.VisibleIndex + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();

                     });
                     column.Settings.AllowDragDrop = DefaultBoolean.False;
                     column.Settings.AllowSort = DefaultBoolean.False;
                     column.Width = 70;
                 });

                 ss.Columns.Add("FYear", "年度");
                 ss.Columns.Add("FPeriod", "编号");
                 ss.Columns.Add("NSRBM", "纳税人编码");
                 ss.Columns.Add("NSRMC", "纳税人名称");
                 ss.Columns.Add("FAmount", "补助金额");

                 ss.TotalSummary.Add(DevExpress.Data.SummaryItemType.Sum, "FAmount").DisplayFormat = "总计: {0}";

                 ss.Settings.ShowFooter = true;
                 ss.SettingsBehavior.AllowSort = false;
                 ss.SettingsBehavior.AllowDragDrop = false;
                 ss.SettingsBehavior.AllowSelectByRowClick = false;
                 ss.SettingsLoadingPanel.Text = "数据读取中...";
                 ss.SettingsBehavior.AllowClientEventsOnLoad = false;
                 ss.SettingsBehavior.AllowFocusedRow = true;
                 ss.CommandColumn.Visible = false;
                 ss.PageIndexChanged = (sender, e) =>
                 {
                     ASPxGridView grid = (ASPxGridView)sender;
                     grid.Selection.UnselectAll();
                 };
                 ss.DataBinding = (sender, e) =>
                 {
                     ASPxGridView grid = (ASPxGridView)sender;
                     for (int i = 0; i < grid.AllColumns.Count; i++)
                     {
                         if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                         {
                             grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                         }
                     }
                     
                     grid.AllColumns[0].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                     grid.AllColumns[1].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                     grid.AllColumns[2].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                 };
                 
             }).Bind(Model).GetHtml()